/**
 * 
 */
package com.nextive.interview.service;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;

import com.nextive.interview.dto.WeightDateSingleLog;

/**
 * Interface to obtain all information about weight histories.
 * @author Cesar Roman
 *
 */
public interface WeightInfoService {
	
	/**
	 * Decimal format used to display corresponding weight.
	 */
	DecimalFormat DECIMAL_FORMAT = new DecimalFormat(
			"##0.0", new DecimalFormatSymbols(Locale.US));

	/**
	 * It fetches all weight histories.
	 * @return
	 */
	List<WeightDateSingleLog> fetchAllWeightInfo();
	
	/**
	 * It fetches all weight histories since a given date.
	 * @param calendar
	 * @return
	 */
	List<WeightDateSingleLog> fetchWeightInfoSince(Calendar calendar);
	
	/**
	 * It fetches a specific weight history.
	 * @param id
	 * @return
	 */
	WeightDateSingleLog fetchWeightInfo(long id);
	
	/**
	 * It fetches last registered weight.
	 * @return
	 */
	Double fetchLastRegisteredWeight();
	
	/**
	 * It deletes a specific weight history row.
	 * @param id
	 * @return true if deleted successfully
	 */
	boolean deleteWeightInfo(long id);
	
	/**
	 * It creates a new weight history entry.
	 * @param weightDateLog
	 * @return the newly row id
	 */
	long createNewWeightEntry(WeightDateSingleLog weightDateLog);
	
	/**
	 * It updates an existing weight history entry.
	 * @param weightDateLog
	 * @return
	 */
	boolean updateWeightInfo(WeightDateSingleLog weightDateLog);

}